package com.atcumt.Thread.singleton;

import java.lang.reflect.Constructor;

public class ReflectionDestroyTest {
    public static void main(String[] args) throws Exception {
        Class objectClass = Singleton.class;
        Constructor constructor = objectClass.getDeclaredConstructor();
        constructor.setAccessible(true);
        Singleton instance = Singleton.getInstance();
        Singleton newInstance = (Singleton) constructor.newInstance();

        System.out.println(instance);
        System.out.println(newInstance);
        System.out.println(instance == newInstance);
    }
}
